///<reference path="./AudioBase.ts" />
/**
 * public AudioQueue:MC.AudioModel.Audio = new MC.AudioModel.Audio;
		public init() {
			let mthis = this; 
			this.AudioQueue.addFile("bgm", "./media/audio/bgm.mp3");
			this.AudioQueue.addFile("choose", "./media/audio/choose.mp3");
			this.AudioQueue.addFile("clickFilm", "./media/audio/clickFilm.mp3");
			this.AudioQueue.addFile("openCD", "./media/audio/openCD.mp3");
			this.AudioQueue.addFile("playCD", "./media/audio/playCD.mp3");
			this.AudioQueue.addFile("openCDvideo", "./media/audio/openCDvideo.mp3");
			this.AudioQueue.load("audio0.png",()=>{ 
				 this.AudioQueue.PlayBack("bgm");
				 this.AudioQueue.createButton();
			}); 
		}
 * 
 */


module MC.AudioModel {
	export class Audio extends AudioBase{
		public constructor() {
			super();
		}
		/**关闭背景音乐 */
		public BackOff(){
			if(this.PlayBackSourceNode){
				this.PlayBackSourceNode.pause();
			}
		}
		/** 打开背景音乐 */
		public BackOn(){
			if(this.PlayBackSourceNode){
				this.PlayBackSourceNode.play();
			}
		}
		private PlayBackSourceNode:SourceNode=null;
		public PlayBack(id: string) {
			 this.PlayBackSourceNode=this.Play(id);
			 if(this.PlayBackSourceNode){
				  this.PlayBackSourceNode.loop=true;
				  return this.PlayBackSourceNode;
			 }else{
				 console.log("未加载:"+id);
				 return null;
			 }
			
		}
	}
}